Skip to content

Fix CIFModel.from_linear_terms to use Poisson log link#65

Merged
iahncajigas merged 5 commits intomainfrom
fix/cif-poisson-link
Mar 16, 2026
Merged

Fix CIFModel.from_linear_terms to use Poisson log link#65
iahncajigas merged 5 commits intomainfrom
fix/cif-poisson-link

Conversation

@iahncajigas
Copy link
Copy Markdown
Contributor

Summary

  • CIFModel.from_linear_terms() incorrectly applied logistic link exp(η)/(1+exp(η)) instead of Poisson log link exp(η)
  • This bounded output rates to ~1 regardless of the linear predictor, breaking any CIF simulation from linear models

Test plan

  • pytest -q passes (12/12, 2 skipped)
  • Verify CIF simulation from fitted GLM coefficients produces correct firing rates

🤖 Generated with Claude Code

iahncajigas and others added 5 commits March 14, 2026 18:48
…istic

The method incorrectly applied exp(eta)/(1+exp(eta)) (logistic/binomial
link) instead of exp(eta) (Poisson log link), producing fire rates
bounded to ~1 regardless of the actual linear predictor.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- nstat/fit.py: clip Z before exp(-Z) to prevent -inf in uniforms;
  filter non-finite values in plotSeqCorr correlation computation
- example03: replace 3D plot_surface with pcolormesh to match MATLAB
  top-down mesh view for stimulus effect surfaces
- example04/05: fix tick_labels → labels for matplotlib <3.9 compat
- Add regenerate_all_figures.py script and CI job to rebuild all
  paper figures on every push

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ing MATLAB

- Accept fit_num=None to overlay all fits (like plotSeqCorr/KSPlot)
- Plot ACF as scatter dots with per-fit colors instead of single-color bars
- Remove max_lag=25 truncation to show full ACF range matching MATLAB xcov
- Add legend with fit labels; CI lines drawn without legend entries
- Update plotResults to call plotInvGausTrans(fit_num=None)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Example 01 Figs 1 & 3: Replace plotResults() 2x4 grid with custom 2x2
  layout matching MATLAB (raster, ACF, KS plot, lambda estimate)
- plotCoeffs: Support multi-fit overlay (default fit_num=None plots all fits)
- plotResidual: Support multi-fit overlay with per-fit colors and legend,
  symmetric y-axis, title changed to "Point Process Residual"
- plotSeqCorr: Title changed to "Sequential Correlation of Rescaled ISIs"
- plotResults: Pass fit_num=None to plotCoeffs and plotResidual

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When comparing models with different numbers of coefficients,
plotCoeffs used xpos from only the first fit's labels. Now builds
a unified x-axis from all fits' labels and maps each fit's coeffs
to the correct positions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@iahncajigas iahncajigas merged commit d12fa25 into main Mar 16, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant